javascript date to php date site:stackoverflow.com

38

//Javascript
var d = new date();
var iso_date_string = d.toISOString(); 
// produces "2014-12-15T19:42:27.100Z"
var locale_date_string = d.toLocaleDateString();
// produces "12/15/2014"

//PHP
$date = date( "Y-m-d H:i:s", strtotime("2014-12-15T19:42:27.100Z") );
// produces "2014-12-15 20:42:27"
$date = date( "Y-m-d", strtotime("12/15/2014") );
// 2014-12-15

Comments

Submit
0 Comments